<%= settings_layout do %>
  <%= turbo_frame_tag "provider" do %>
    <%= render "providers/index" %>
    <div class="font-lg font-bold mt-4">
      Add <%= params[:provider_type]&.titleize || @provider.provider.titleize %> Credentials
    </div>
    <div>
      <div class="mt-2 mb-4">
        <% if params[:provider_type] == Provider::CUSTOM_REGISTRY_PROVIDER %>
          <div class="text-sm text-gray-500">
            Select your container registry provider or enter a custom URL.
          </div>
          <div class="mt-2">
            Make sure you have the <code class="mx-2 bg-white text-black px-2 py-1 rounded-md">Read & Write</code> permission if you want to deploy a private image.
          </div>
        <% elsif params[:provider_type] == Provider::GITHUB_PROVIDER %>
          <%= link_to "Find your Github token →", "https://github.com/settings/tokens", target: "_blank", class: "text-sm text-gray-500 " %>
          <div class="mt-2">
            Select the
            <% Providers::CreateGithubProvider::EXPECTED_SCOPES.each do |scope| %>
              <code class="mx-2 bg-white text-black px-2 py-1 rounded-md"><%= scope %></code>
            <% end %>
            permissions.
          </div>
        <% elsif params[:provider_type] == Provider::GITLAB_PROVIDER %>
          <%= link_to "Find your Gitlab token →", "https://gitlab.com/-/user_settings/personal_access_tokens", target: "_blank", class: "text-sm text-gray-500 " %>
          <div class="mt-2">
            Select the
            <% Providers::CreateGitlabProvider::EXPECTED_SCOPES.each do |scope| %>
              <code class="mx-2 bg-white text-black px-2 py-1 rounded-md"><%= scope %></code>
            <% end %>
            permissions.
          </div>
        <% end %>
      </div>
    </div>
    <%= render "providers/form", provider: @provider %>
  <% end %>
<% end %>